package com.howard.webapp.familymanagement.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@DynamicInsert 
@DynamicUpdate //生成的SQL中涉及的字段只包含User类中修改的属性所对应的表字段
@Table(name="T_USER")
public class User {

	@Id
	@Column(name = "ID") 
	@SequenceGenerator(name="USER_ID_GENERATOR", sequenceName="SEQ_USER_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="USER_ID_GENERATOR")
	private Long id;
	
	/**
	 * 如果不指定表字段，会自动映射为USERNAME
	 * 并且在加载运行时，发现没有该表字段，会自动添加创建（如果表，Sequence没有也会创建）。
	 * 对应ORACLE，创建的的类型对应关系：
	 * 		String 	VARCHAR2(255 CHAR)
	 * 		Long	NUMBER(19)
	 * 		Integer NUMBER(10)
	 * 		java.sql.Date	DATE
	 * 		java.sql.Time	DATE
	 * 		java.util.Date	TIMESTAMP(6)
	 * 		java.sql.Timestamp	TIMESTAMP(6)	
	 */
	@Column(name = "LOGIN_ID", unique = true) 
	private String loginId;
	
	@Column(name = "NAME") 
	private String name;
	
	@Column(name = "SEX") 
	private String sex;
	
	@Column(name = "DOB") 
	private Date dob;
	
	@Column(name = "PHOTO") 
	private String photo;
	
	@Column(name = "TEL") 
	private String tel;
	
	@Column(name = "PWD") 
	private String pwd;
	
	@Column(name = "LIVING_ADDR") 
	private String livingAddr;
	
	@Column(name = "HOMETOWN") 
	private String hometown;
	
	@Column(name = "IS_ADMIN") 
	private String isAdmin;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLoginId() {
		return loginId;
	}

	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public Date getDob() {
		return dob;
	}

	public void setDob(Date dob) {
		this.dob = dob;
	}

	public String getPhoto() {
		return photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getLivingAddr() {
		return livingAddr;
	}

	public void setLivingAddr(String livingAddr) {
		this.livingAddr = livingAddr;
	}

	public String getHometown() {
		return hometown;
	}

	public void setHometown(String hometown) {
		this.hometown = hometown;
	}

	public String getIsAdmin() {
		return isAdmin;
	}

	public void setIsAdmin(String isAdmin) {
		this.isAdmin = isAdmin;
	}
	
	
}
